package com.ginmeta.common.enums;

import com.ginmeta.common.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 性别枚举
 * @author GinMeta
 */
@AllArgsConstructor
@Getter
public enum GenderEnum {

    /**
     * 性别 M-男 F-女
     */
    MAN("M", "男"),
    FEMALE("F", "女"),
    UNKNOWN("N", "未知");

    private final String value;

    private final String info;

    /**
     * 校验枚举值
     * @param value 枚举值
     * @return true-正确 false-不正确
     */
    public static boolean check(String value) {
        if (StringUtils.isBlank(value)) {
            return false;
        }
        for (GenderEnum status : GenderEnum.values()) {
            if (status.getValue().equals(value)) {
                return true;
            }
        }
        return false;
    }
}
